import Vue from 'vue'
import Vuex from "vuex"
Vue.use(Vuex)
export default new Vuex.Store({
	//全局的属性变量
	state: {
		// 当前的登陆用户
		currentUser: {},
		// 当前选择的受益人
		currentSyr: {},
		currentJcrDetail:{}
	},
	getters: {
		currentUser(state) {
			return state.currentUser
		},
		currentSyr(state) {
			return state.currentSyr
		},
		currentJcrDetail(state) {
			return state.currentJcrDetail
		}
	},
	//全局同步方法，调用方法：this.$store.commit('xxx')
	mutations: {
		// 设置登陆用户
		setCurrentUser(state, data) {
			state.currentUser = data
		},
		// 设置受益人信息
		setCurrentSyr(state, data) {
			state.currentSyr = data
		},
		// 设置受益人信息
		setCurrentJcrDetail(state, data) {
			state.currentJcrDetail = data
		},
	},
})
